package com.dq.domain.service;

import com.dq.vo.baseVo.VO;
import com.dq.domain.base.BaseEntity;
import com.dq.domain.record.ServiceRecord;
import com.dq.domain.sys.user.user.StaffUser;
import com.dq.utils.TimeUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;

/**
 * @author cf
 */
@Data
@Entity
@ApiModel("服务项目_记录关联表")
public class ServiceProjectRecordCentre extends BaseEntity implements VO.ToVO {

    @ManyToOne
    @ApiModelProperty("服务记录")
    protected ServiceRecord serviceRecord;
    @ManyToOne
    @ApiModelProperty("服务项目")
    protected ServiceProject serviceProject;

    @Data
    @ApiModel(value = "服务项目_记录关联视图")
    public static class Vo implements VO {

    }

    @Override
    public VO toVO(boolean isRecursion) {
        Vo vo = new Vo();

        return vo;
    }

    @Data
    @ApiModel("用户服务记录列表")
    public static class UserServiceRecord{
        @ApiModelProperty("服务开始时间")
        protected String serviceBeginTime;
        @ApiModelProperty("技师")
        protected String staffUser;
        @ApiModelProperty("服务项目名称")
        protected String projectName;
        @ApiModelProperty("预约次数")
        protected Long subscribeNum;
        @ApiModelProperty("服务次数")
        protected Long serviceNum;
        @ApiModelProperty("是否评价")
        protected Boolean isEvaluate;
    }



    //Long subscribeNum,Long serviceNum,
    public UserServiceRecord toUserServiceRecord(Boolean isEvaluate){
        UserServiceRecord vo = new UserServiceRecord();
        vo.serviceBeginTime = fmt(this.serviceRecord.getServiceBeginTime(), TimeUtil.YYYY_MM_DD_HH_MM_SS);
        StaffUser staffUser = (StaffUser)this.getServiceRecord().getStaffUser();
        vo.staffUser = staffUser.getUserRealcName();
        vo.projectName = this.serviceProject.projectName;
//        vo.subscribeNum = subscribeNum;
//        vo.serviceNum = serviceNum;
        vo.isEvaluate = isEvaluate;
        return vo;
    }
}
